package org.jumiz.db.http.handler;

import java.io.IOException;
import java.io.OutputStream;

import org.jumiz.db.result.TypeResultZ;
import org.jumiz.db.util.DocDBUtilZ;

import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;

public final class JumiZHtmlHandler implements HttpHandler {

	@Override
	public void handle(HttpExchange exchange) throws IOException {
		String response = "{\"error\":\"error\"}";
		try {
			response = new DocDBUtilZ().doc(TypeResultZ.HTML);
			exchange.sendResponseHeaders(200, 0);
		} catch (ClassNotFoundException e) {
			exchange.sendResponseHeaders(404, 0);
			e.printStackTrace();
		}
        OutputStream os = exchange.getResponseBody();
        os.write(response.getBytes());
        os.close();
	}

}
